using System.Data;
using VanTaiProperty;
namespace VanTaiData
{
    public class clsTMProvinceController
    {
        private clsConnect cls = new clsConnect();

        #region Getdata
        public DataTable BindGirdTMProvince(string keywords)
        {
            return cls.Search("sp_TMProvince", "@KeyWords", keywords);
        }
        public DataTable BindGirdTMProvinceDetail(int id)
        {
            return cls.LayDuLieuParameter("sp_TMProvince_Detail", "@Province_ID", id);
        }
        public DataTable BindGirdTMProvinceFilterMien(int id)
        {
            return cls.LayDuLieuParameter("sp_TMProvince_FilterMien", "@Region_ID", id);
        }
        #endregion

        #region Insert
        public bool InsertTMProvince(clsTMProvinceProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Province_Alias", data.Province_Alias);
            cls.AddParameter("@Province_Name", data.Province_Name);
            cls.AddParameter("@Region_ID", data.Region_ID);
            cls.AddParameter("@Province_Note", data.Province_Note);
            cls.AddParameter("@Province_MaCha", data.Province_MaCha);
            cls.AddParameter("@Province_NameE", data.Province_NameE);
            cls.AddParameter("@Province_NameC", data.Province_NameC);
            cls.ExecuteNonQuery("sp_TMProvince_Insert");
            return true;
        }
        #endregion

        #region Update
        public bool UpdateTMProvince(clsTMProvinceProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Province_ID", data.Province_ID);
            cls.AddParameter("@Province_Alias", data.Province_Alias);
            cls.AddParameter("@Province_Name", data.Province_Name);
            cls.AddParameter("@Region_ID", data.Region_ID);
            cls.AddParameter("@Province_Note", data.Province_Note);
            cls.AddParameter("@Province_MaCha", data.Province_MaCha);
            cls.AddParameter("@Province_NameE", data.Province_NameE);
            cls.AddParameter("@Province_NameC", data.Province_NameC);
            cls.ExecuteNonQuery("sp_TMProvince_Update");
            return true;
        }
        #endregion

        #region Delete
        public bool DeleteTMProvince(int id)
        {
            cls.Delete("sp_TMProvince_Delete", "@Province_ID", id);
            return true;
        }
        #endregion
    }
}